import Promise from 'bluebird';
import { exec } from 'child_process';

/**
 * Promisified `childProcess.exec`
 * @return {Promise}
 */
export function execAsync(...args) {
    return new Promise((resolve, reject) => {
        return exec(...args, (error, stdout, stderr) => {
            if (error) {
                return reject(error);
            }

            return resolve({
                stdout,
                stderr
            });
        });
    });
}